import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import Login from '../views/Login.vue'
import Home from '../views/Home.vue'
import Errorpage from '../views/Errorpage.vue'
import Firstpage from '../views/Firstpage.vue'
import TongCheng from '../views/TongCheng.vue'
import Daohang from '../views/Daohang.vue'
import PointShop from '../views/PointShop.vue'
import Libaiwu from '../views/Libaiwu.vue'
import NewRegiste from '../views/NewRegiste.vue'
import PaySuccess from "../views/PaySuccess.vue"
import ShoppingCart from "../views/ShoppingCart.vue"
import GoodsType from "../views/GoodsType.vue"
import SearchPage from "../views/SearchPage.vue"
import ShopPage from "../views/ShopPage.vue"
import GoodsDetail from "../views/GoodsDetail.vue"
Vue.use(VueRouter)

const routes = [
  {
    path:'',
    redirect:'/index',
  },
  {
    path: '/index',
    // name: 'index',
    component: Index,
    children:[
      {
        path: '',
        redirect:'login',
      },
      {
        path: 'login',
        name: 'login',
        component: Login,
      },
      {
        path:'paysuccess',
        // name:'paysuccess',
        component:PaySuccess,
      },
      
      {
        path:'shoppingcart',
        // name:'shoppingcart',
        component:ShoppingCart,
      },
      {
        path: 'home',
        name: 'home',
        component: Home,
        children:[
          {
            path: '',
            redirect:'firstpage',
          },
          {
            path: 'firstpage',
            // name: 'firstpage',
            component: Firstpage,
          },
          {
            path: 'goodstype',
            name: 'goodstype',
            component: GoodsType,
          },
          {
            path: 'tongcheng',
            // name: 'tongcheng',
            component: TongCheng,
          },
          {
            path: 'pointshop',
            // name: 'pointshop',
            component: PointShop,
          },
          {
            path: 'daohang',
            // name: 'daohang',
            component: Daohang,
          },
          {
            path:'searchpage',
            name:'searchpage',
            component:SearchPage,
          },
          {
            path: 'libaiwu',
            // name: 'libaiwu',
            component: Libaiwu,
            children:[
              {
                path:'',
                redirect:'newregiste',
              },
              {
                path:'newregiste',
                // name:'newregiste',
                component:NewRegiste,
                
              }
            ]
          },
          {
            path:'shoppage',
            component:ShopPage,
          },
          {
            path:'goodsdetail',
            component:GoodsDetail,
          },
        ]
      },
    ]
  },
  
  {
    path:'*',
    component: Errorpage,
  },
  
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  routes
})

export default router
